package work20241223;

import java.util.concurrent.Callable;
import java.util.concurrent.FutureTask;

/**
 * @author zdl
 * @date 2024/12/23
 */
class MyFirstCallable implements Callable<String>{
    @Override
    public String call() throws Exception {
        for (int i = 0; i < 100; i++) {
            System.out.println("MyFirstCallable:"+i);
        }
        return "hhhh哈哈";
    }
}
public class Demo2 {
    public static void main(String[] args) {
        MyFirstCallable myFirstCallable = new MyFirstCallable();
        FutureTask<String> task = new FutureTask<>(myFirstCallable);
        Thread thread = new Thread(task);
        thread.start();
    }
}
